import { ipcRenderer } from "electron";
import { IChildWindowParams, IcreateWindowParams, windowTabType } from "../types/window";

export const WindowPreload = {
  // 窗口控制
  controlTabBar: (params: windowTabType): void => {
    ipcRenderer.send("controlTabBar", params);
  },
  // 创建窗口
  createWindow: (params: IcreateWindowParams) => {
    return ipcRenderer.invoke("createWindow", params);
  },

  // 创建子窗口
  createChildWindow: (params: IChildWindowParams): void => {
    ipcRenderer.send("createChildWindow", params);
  },
  // 关闭窗口
  closePage: (name: string, isBackLogin: boolean = false) => {
    ipcRenderer.send("closePage", name, isBackLogin);
  },
};
